package com.ruoyi.vstac.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.vstac.domain.VstacEvaluation;
import com.ruoyi.vstac.service.IVstacEvaluationService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 评价 Controller
 * 
 * @author ruoyi
 * @date 2024-06-11
 */
@RestController
@RequestMapping("/vstac/evaluation")
public class VstacEvaluationController extends BaseController
{
    @Autowired
    private IVstacEvaluationService vstacEvaluationService;

    /**
     * 查询评价 列表
     */
    @PreAuthorize("@ss.hasPermi('vstac:evaluation:list')")
    @GetMapping("/list")
    public TableDataInfo list(VstacEvaluation vstacEvaluation)
    {
        startPage();
        List<VstacEvaluation> list = vstacEvaluationService.selectVstacEvaluationList(vstacEvaluation);
        return getDataTable(list);
    }

    /**
     * 导出评价 列表
     */
    @PreAuthorize("@ss.hasPermi('vstac:evaluation:export')")
    @Log(title = "评价 ", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, VstacEvaluation vstacEvaluation)
    {
        List<VstacEvaluation> list = vstacEvaluationService.selectVstacEvaluationList(vstacEvaluation);
        ExcelUtil<VstacEvaluation> util = new ExcelUtil<VstacEvaluation>(VstacEvaluation.class);
        util.exportExcel(response, list, "评价 数据");
    }

    /**
     * 获取评价 详细信息
     */
    @PreAuthorize("@ss.hasPermi('vstac:evaluation:query')")
    @GetMapping(value = "/{evaluationId}")
    public AjaxResult getInfo(@PathVariable("evaluationId") Integer evaluationId)
    {
        return success(vstacEvaluationService.selectVstacEvaluationByEvaluationId(evaluationId));
    }

    /**
     * 新增评价 
     */
    @PreAuthorize("@ss.hasPermi('vstac:evaluation:add')")
    @Log(title = "评价 ", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody VstacEvaluation vstacEvaluation)
    {
        return toAjax(vstacEvaluationService.insertVstacEvaluation(vstacEvaluation));
    }

    /**
     * 修改评价 
     */
    @PreAuthorize("@ss.hasPermi('vstac:evaluation:edit')")
    @Log(title = "评价 ", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody VstacEvaluation vstacEvaluation)
    {
        return toAjax(vstacEvaluationService.updateVstacEvaluation(vstacEvaluation));
    }

    /**
     * 删除评价 
     */
    @PreAuthorize("@ss.hasPermi('vstac:evaluation:remove')")
    @Log(title = "评价 ", businessType = BusinessType.DELETE)
	@DeleteMapping("/{evaluationIds}")
    public AjaxResult remove(@PathVariable Integer[] evaluationIds)
    {
        return toAjax(vstacEvaluationService.deleteVstacEvaluationByEvaluationIds(evaluationIds));
    }
}
